﻿using ACompany.OrderProcessing.Model;
using NUnit.Framework;

[TestFixture()]
public class OrderTests
{

    [Test()]

    public void An_Order_Cannot_Be_Processed_Unless_All_OF_The_Items_Are_In_Stock()
    {
        Order anOrder = new Order();
        Customer aCustomer = new Customer();
        Address anAddress = new Address("Street", "City", "County", "PostCode");
        aCustomer.Address = anAddress;
        Product aProduct = new Product();

        anOrder.Customer = aCustomer;
        anOrder.DespatchAddress = anAddress;

        aProduct.Name = "Hat";
        aProduct.Price = 78.99m;
        aProduct.Stock = 0;

        anOrder.Add(aProduct);

        Assert.IsFalse(anOrder.CanProcess());

    }

    [Test()]

    public void An_Order_Can_Be_Processed_If_All_Items_Are_In_Stock()
    {
        Order anOrder = new Order();
        Customer aCustomer = new Customer();
        Address anAddress = new Address("Street", "City", "County", "PostCode");
        aCustomer.Address = anAddress;
        Product aProduct = new Product();

        anOrder.Customer = aCustomer;
        anOrder.DespatchAddress = anAddress;

        aProduct.Name = "Hat";
        aProduct.Price = 78.99m;
        aProduct.Stock = 1;

        anOrder.Add(aProduct);

        Assert.IsTrue(anOrder.CanProcess());

    }

}